package org.example.meetingsystem.entity;

import com.baomidou.mybatisplus.annotation.*;
import com.baomidou.mybatisplus.extension.activerecord.Model;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.example.meetingsystem.enums.PaymentStatus;
import org.example.meetingsystem.enums.ReservationStatus;

import java.math.BigDecimal;
import java.time.LocalDateTime;

@Data
@EqualsAndHashCode(callSuper = false)
@TableName("reservations")
public class Reservation extends Model<Reservation> {
    @TableId(value = "id", type = IdType.AUTO)
    private Long id;

    @TableField("customer_id")
    private Long customerId;

    @TableField("room_id")
    private Long roomId;

    @TableField("start_time")
    private LocalDateTime startTime;

    @TableField("end_time")
    private LocalDateTime endTime;

    @TableField("attendee_count")
    private Integer attendeeCount;

    @TableField("total_amount")
    private BigDecimal totalAmount;

    @TableField("status")
    private ReservationStatus status;

    @TableField("payment_status")
    private PaymentStatus paymentStatus;

    @TableField("lock_expires_at")
    private LocalDateTime lockExpiresAt;

    @TableField("requirements")
    private String requirements;

    @TableField(value = "created_at", fill = FieldFill.INSERT)
    private LocalDateTime createdAt;

    @TableField(value = "updated_at", fill = FieldFill.INSERT_UPDATE)
    private LocalDateTime updatedAt;

    // 关联查询字段
    @TableField(exist = false)
    private User customer;

    @TableField(exist = false)
    private MeetingRoom room;
}
